


project, uses(../data_output/termlimited.dta)

	
	use ../data_output/termlimited.dta, clear

	keep if max_terms_in_office<=8
	binscatter first_pc1 max_terms_in_office , ///
			xq(max_terms_in_office) xtitle("Total Number of Elections Won in Career") ///
			ytitle("Productivity In First Term") xlabel( 1 (1) 8 ) linetype(lfit)   ///
			savegraph(../tables_figures/selection_productivity.pdf) scale(1.3) replace
			

			
	use ../data_output/termlimited_includenontermlimitstates.dta, clear

	*construct principal components based on sponsorship and cmt activity
	pca log_sponsored cmt_index
	predict pc, score
	sum pc
	replace pc = [pc - r(mean) ]/ r(sd) 	
	
	corr pc pc1 // correlates at .93
		
	sort CandId year
	bys CandId: gen tmp = pc if _n==1
	bys CandId: egen first_pc = max(tmp)
	
	keep if  termlimits_effective_dummy==0 & max_terms_in_office<=15
	
	binscatter first_pc max_terms_in_office , ///
			xq(max_terms_in_office) xtitle("Total Number of Elections Won in Career") ///
			ytitle("Productivity In First Term") xlabel( 1 (1) 15 ) linetype(lfit)   ///
			savegraph(../tables_figures/selection_only_nontermlimitstates.pdf) scale(1.3) replace
	

			
				